
<h2>ข้อมูลผู้ใช้</h2>
<form>
<fieldset>
	<legend><strong>ค้นหา</strong></legend>
		<div>
		ชื่อผู้ใช้งาน /Email        : <input type="text" name="search" value="<?=@$_GET['search'];?>" size="40"> 
		<input type="submit" name="submit" value="Search">   		
		</div> 

</fieldset>
</form>
<br>
  	<? if(permission($menu_id, 'canadd')!=''){ ?> 
	<div id="btnBox" align="right"><a href="<?=$urlpage;?>/form" style="text-decoration:none;"><input type="button" class="ui-state-active ui-corner-all btnAdd" value="เพิ่มรายการ"></a></div>
	<? } ?>
	
<div id="paging" class="pagination">
<?php echo $pagination;?>
</div>
<div id="main-content">
	<table class="tbContainer">
		<tr>
			<td align="left">
				<table border="0" cellpadding="10" cellspacing="0" width="100%">
						<tr class="ui-state-error">
							<th class="ui-state-error tdlist">ลำดับ</th>
							<th class="ui-state-error tdlist">ชื่อ - นามสกุล</th>
							<th class="ui-state-error tdlist">Email</th>
							<th class="ui-state-error tdlist">Admin Group</th>
							<th class="ui-state-error tdlist">Register Date</th>
							<th class="ui-state-error tdlist">Manage</th>
						</tr>
						<?php 
						  $rowStyle = '';
						  $page = (isset($_GET['page']))? $_GET['page']:1;
						  $i=(isset($_GET['page']))? (($_GET['page'] -1)* 10)+1:1;
						  foreach($result as $row):
						?>  
						<tr <? if($rowStyle =='')$rowStyle = 'class="odd"';else $rowStyle = "";echo $rowStyle;?> >
						  <td class="tdlist"><?=$i;?></td>
						  <td class="tdlist" style="cursor: pointer;" onclick="window.location='<?=$urlpage;?>/form/<?=$row['id'];?>'">
						  	<?=$row['name'];?> 
						  </td>		  
						  <td class="tdlist" style="cursor: pointer;" align="center" onclick="window.location='<?=$urlpage;?>/form/<?=$row['id'];?>'"><?=$row['email'];?></td>
						  <td class="tdlist" style="cursor: pointer;" align="center" onclick="window.location='<?=$urlpage;?>/form/<?=$row['id'];?>'">
						  	<?
						  		echo @$this->db->getone("SELECT name FROM usertype WHERE id=".$row['usertype']);
						  	?>
						  </td>
						  <td class="tdlist" style="cursor: pointer;" align="center" onclick="window.location='<?=$urlpage;?>/form/<?=$row['id'];?>'"><?=$row['registerdate'];?></td>		  
						  <td class="tdlist">
						  	<? if(permission($menu_id, 'candelete')!=''){ ?>
						  	<a href="<?=$urlpage;?>/delete/<?php echo $row['id']?>" style="text-decoration:none;" onclick="return confirm('<?php echo NOTICE_CONFIRM_DELETE?>')"><input type="button" class="btn_delete" /></a>
						  	<? } ?>    	
						  </td>
						  </tr>
						<tr>
								<? 
								$i++;
						  		endforeach; 
								?>		
				</table>
			</td>
		</tr>
	</table>
</div>